<!DOCTYPE html>
<html>

<head>
	<meta charset="UTF-8">
	<title></title>
	<style type="text/css">
		html,
		body {
			margin: 0;
			padding: 0;
			width: 100%;
			height: 100%;
			overflow: hidden;
		}
	</style>
	<script type="text/javascript" src="/spa/document/WebOffice.js"></script>
	<script language="javascript" for=WebOffice event="OnMenuClick(vIndex,vCaption)">
		if (vIndex == 1) {
			WebOpenLocal(); //打开本地文件
		}
		if (vIndex == 2) {
			WebSaveLocal(); //保存本地文件
		}
		if (vIndex == 3) {
			SaveDocument(); //保存正文到服务器上（不退出）
		}
		if (vIndex == 5) {
			WebOpenSignature(); //签名印章
		}
		if (vIndex == 6) {
			WebShowSignature(); //验证签章
		}
		if (vIndex == 8) {
			WebSaveVersion(); //保存版本
		}
		if (vIndex == 9) {
			WebOpenVersion(); //打开版本
		}
		if (vIndex == 11) {
			SaveDocument(); //保存正文到服务器上
			// webform.submit(); //然后退出
		}
		if (vIndex == 13) {
			WebOpenPrint(); //打印文档
		}
	</script>

	<SCRIPT language=javascript for=WebOffice event=OnToolsClick(vIndex,vCaption)>
		//响应工具栏事件
		if (vIndex == 11) {
			alert('编号:' + vIndex + '\n\r' + '标题:' + vCaption + '\n\r' + '请根据这些信息编写具体功能' + '\n\r\n\r' + '窗口状态:' + webform.WebOffice.WindowStatus);
		}
		if (vIndex == 12) {
			webform.WebOffice.Alert('自定义工具栏测试');
		}
			//if (vIndex==-1){webform.WebOffice.Alert(vCaption);}             //在完成相应操作后响应iWebOffice标准工具栏操作铵钮事件，如"手写批注",vCaption="手写批注"
	</SCRIPT>
	<script language=javascript>
		var parseQueryString = function (url) {
			var reg_url = /^[^\?]+\?([\w\W]+)$/,
				reg_para = /([^&=]+)=([\w\W]*?)(&|$)/g, //g is very important
				arr_url = reg_url.exec(url),
				ret = {};
			if (arr_url && arr_url[1]) {
				var str_para = arr_url[1], result;
				while ((result = reg_para.exec(str_para)) != null) {
					ret[result[1]] = result[2];
				}
			}
			return ret;
		}

		function toSaveDocument(obj) {
			if (obj && obj.fileName) {
				document.getElementById("WebOffice").FileName = obj.fileName;
			}
			return SaveDocument();
		}

		//作用：载入iWebOffice
		function Load() {
			//使用方法：
			//alert(window.location.href);
			var obj = parseQueryString(window.location.href);
			var docid = obj.mRecordID || '';
			var isEdit = false;
			if (docid != "") {
				try {
					docid = obj.mRecordID.split("_")[1];
					if (parseInt(docid) > 0) {
						isEdit = true;
					}
				} catch (e) { }

			}
			try {
				//以下属性必须设置，实始化iWebOffice
				document.getElementById("WebOffice").WebUrl = "/docs/docs/OfficeServer.jsp"; //WebUrl:系统服务器路径，与服务器文件交互操作，如保存、打开文档，重要文件
				document.getElementById("WebOffice").RecordID = obj.mRecordID || ''; //RecordID:本文档记录编号
				document.getElementById("WebOffice").SAVETYPE = isEdit ? "E9EDIT" : ""; //RecordID:本文档记录编号
				document.getElementById("WebOffice").NONEWVERSION = "TRUE";
				document.getElementById("WebOffice").Template = obj.mTemplate || '';  //Template:模板编号
				document.getElementById("WebOffice").FileName = obj.mFileName || ''; //FileName:文档名称
				document.getElementById("WebOffice").FileType = obj.mFileType || ''; //FileType:文档类型  .doc  .xls  .wps
				// document.getElementById("WebOffice").UserName="<%=mUserName%>";            //UserName:操作用户名，痕迹保留需要
				document.getElementById("WebOffice").EditType = obj.mEditType || ''; //EditType:编辑类型  方式一、方式二  <参考技术文档> 第一位可以为0,1,2,3 其中:0不可编辑;1可以编辑,无痕迹;2可以编辑,有痕迹,不能修订;3可以编辑,有痕迹,能修订；//第二位可以为0,1 其中:0不可批注,1可以批注。可以参考iWebOffice2003的EditType属性，详细参考技术白皮书
				document.getElementById("WebOffice").MaxFileSize = 8 * 1024; //最大的文档大小控制，默认是8M，现在设置成4M。
				document.getElementById("WebOffice").Language = "CH"; //Language:多语言支持显示选择   CH简体 TW繁体 EN英文
				// document.getElementById("WebOffice").AllowEmpty=false;                     //控制不允许保存空白内容的文档
				document.getElementById("WebOffice").ShowMenu = "1"; //控制整体菜单显示
				//以下为自定义菜单↓
				if (obj.mEditType == "1") {
					document.getElementById("WebOffice").AppendMenu("1", "打开本地文件(&L)");
					document.getElementById("WebOffice").AppendMenu("2", "保存本地文件(&S)");
					// document.getElementById("WebOffice").AppendMenu("3","保存远程文件(&U)");
					// document.getElementById("WebOffice").AppendMenu("4","-");
					// document.getElementById("WebOffice").AppendMenu("5","签名印章(&Q)");
					// document.getElementById("WebOffice").AppendMenu("6","验证签章(&Y)");
					// document.getElementById("WebOffice").AppendMenu("7","-");
					// document.getElementById("WebOffice").AppendMenu("8","保存版本(&B)");
					// document.getElementById("WebOffice").AppendMenu("9","打开版本(&D)");
					// document.getElementById("WebOffice").AppendMenu("10","-");
					// document.getElementById("WebOffice").AppendMenu("11","保存并退出(&E)");
					// document.getElementById("WebOffice").AppendMenu("12","-");
					// document.getElementById("WebOffice").AppendMenu("13","打印文档(&P)");
				}
				//以上为自定义菜单↑
				// document.getElementById("WebOffice").DisableMenu("宏(&M);选项(&O)...");    //禁止某个（些）菜单项
				var flag = document.getElementById("WebOffice").WebOpen(); //打开该文档    交互OfficeServer  调出文档OPTION="LOADFILE"    调出模板OPTION="LOADTEMPLATE"     <参考技术文档>
				StatusMsg(WebOffice.Status); //状态信息
				if (flag) {
					onLoadEnd(obj.reload);
				}
			} catch (e) {
				alert(e.description); //显示出错误信息
			}

		}
		//作用：保存为HTML文档
		function WebSaveAsHtml() {
			try {
				document.getElementById("WebOffice").WebSaveAsHtml("8");
				StatusMsg(WebOffice.Status);
			} catch (e) {
				alert(e.description);
			}
		}

		function onLoadEnd(reload) {
			if (!window.parent.docid) {
				loadContent();
			}
			//alert(reload);
			if (reload && window.parent.docid) {
				window.parent.columnData = window.parent.columnDataTemp;
				loadContent();
				document.getElementById("WebOffice").RecordID = window.parent.versionId + "_" + window.parent.docid;
			}
		}

		/*
		 * 生成正文方法	
		 */
		function loadContent() {
			try {
				var startIndex = 0;
				var office = document.getElementById("WebOffice").WebObject;
				var bookMarkName = "Content";
				try {
					// var bookMark = office.Bookmarks(bookMarkName);
				} catch (e) {
					alert("模板有误，排版失败，请联系管理员111");
					return;
				}
				try {
					var range = office.Bookmarks("periods").range;
					range.text = window.parent.periods;
					office.Bookmarks.Add("periods", range);
				} catch (e) { }
				var data = window.parent.columnData;
				//alert("加载正文测试:" + JSON.stringify(data));
				for (var obj in data) {
					var dataList = data[obj] ? data[obj].data : [];
					var id = data[obj] ? data[obj].id : "";
					var name = data[obj] ? data[obj].name : "";
					if (id && name) {
						var con = "【" + name + "】\n";
						var bookMark = office.Bookmarks(bookMarkName);
						var end = bookMark.end;
						if (!startIndex)
							startIndex = end;
						var newRange = office.Range(end, end);
						newRange.Font.Name = "仿宋_GB2312";
						newRange.Font.Size = 14;
						newRange.font.Bold = true;
						newRange.text = con;
						office.Bookmarks.Add("lm_" + id, newRange);
						bookMarkName = "lm_" + id;
						for (var i = 0; i < dataList.length; i++) {
							var cid = dataList[i].id;
							var title = dataList[i].title;
							var content = dataList[i].content;
							var unit = dataList[i].unit;
							unit = unit ? ("（" + unit + "）") : "";
							bookMark = office.Bookmarks(bookMarkName);
							end = bookMark.end;
							newRange = office.Range(end, end);
							newRange.Font.Name = "仿宋_GB2312";
							newRange.Font.Size = 14;
							newRange.font.Bold = true;
							newRange.text = "▲" + title + "。";
							office.Bookmarks.Add("nr_" + cid + "_title", newRange);
							var _end = office.Bookmarks("nr_" + cid + "_title").end;
							newRange = office.Range(_end, _end);
							newRange.font.Bold = false;
							newRange.Font.Name = "仿宋_GB2312";
							newRange.Font.Size = 14;
							newRange.text = content + unit + "\n";
							//newRange = office.Range(end,office.Bookmarks("body").end-1);
							office.Bookmarks.Add("nr_" + cid, newRange);
							bookMarkName = "nr_" + cid;
						}
					}
					//在末尾处重新处理body标签
				}
				office.Bookmarks("Content").Delete();
				bookMark = office.Bookmarks(bookMarkName);
				var end = bookMark.end;
				office.Bookmarks.Add("Content", office.Range(end, end));
			} catch (e) {
				alert("加载正文有误,请联系管理员");
			}
		}

		/*
		 * 标签校验	
		 */
		function checkBody() {
			var office = document.getElementById("WebOffice").WebObject;
			try {//修改时判断body标签是否存在
				office.Bookmarks("Content");
			} catch (e) {//如果不存在  重新在最后一个书签后面追加  Body书签
				try {
					var count = office.Bookmarks.count;
					var end = 0;
					for (var i = 1; i <= count; i++) {//循环找到最后一个书签的位置
						var indexname = office.Bookmarks(i).name;
						if (indexname != "periods") {
							var _end = office.Bookmarks(i).range.end;
							if (_end > end)
								end = _end;
						}
					}
					if (end == 0) {
						office.select();
						end = office.Application.Selection.Range.end - 32;//默认给页尾预留32个字符位置
					}
					var newRange = office.Range(end, end);
					office.Bookmarks.Add("Content", newRange);
				} catch (e) {
					return false;
				}
			}
			return true;
		}

		/*
		 * 	变更正文
		 */
		function changeContent(jsonData) {
			//alert("变更正文:" + JSON.stringify(jsonData));
			var _data = jsonData.returnMap;
			var returnList = jsonData.returnList;
			var _typeList = jsonData.typeList;
			var data = window.parent.columnData;
			var siftData = window.parent.siftData;
			var newSiftData = {};
			//selectedIds = jsonData.returnStr;
			var bookMarkName = "Content";
			var sbookMarkId = "";//第一个书签的开始位置
			if (!checkBody()) {
				alert("文档已经损坏");
				return;
			}
			try {
				var office = document.getElementById("WebOffice").WebObject;
				var flag = false;
				//for(var obj in _data){
				for (var ti = 0; ti < _typeList.length; ti++) {
					var obj = _typeList[ti];
					var typeid = obj.id;
					try {
						flag = true;
						var dataList = _data[typeid] ? _data[typeid].data : [];
						var id = _data[typeid] ? _data[typeid].id : "";
						var name = _data[typeid] ? _data[typeid].name : "";
						var dataListOld = [];
						if (id && name) {
							if (typeid in data) {
								try {
									//alert("栏目重构：" + id);
									office.Bookmarks("lm_" + id).range.text = "";
									dataListOld = data[typeid].data;
								} catch (e) { alert("栏目重构异常" + e); console.log("栏目重构异常", _data[typeid], e); }
							}
							if (!sbookMarkId)
								sbookMarkId = id;
							var con = "【" + name + "】\n";
							var bookMark = office.Bookmarks(bookMarkName);
							var end = bookMark.end;
							var newRange = office.Range(end, end);
							newRange.Font.Name = "仿宋_GB2312";
							newRange.Font.Size = 14;
							newRange.font.Bold = true;
							newRange.text = con;
							office.Bookmarks.Add("lm_" + id, newRange);
							bookMarkName = "lm_" + id;

							for (var i = 0; i < dataList.length; i++) {
								try {
									var cid = dataList[i].id;
									var title = dataList[i].title;
									var content = dataList[i].content;
									var unit = dataList[i].unit;
									unit = unit ? ("（" + unit + "）") : "";
									content = content + unit + "\n";
									if (cid in siftData) {//不是新增的文档 取当前内容中信息
										content = office.Bookmarks("nr_" + cid).range.text + "\n";
										//title = office.Bookmarks("nr_"+cid+"_title").range.text;
										office.Bookmarks("nr_" + cid).range.text = "";
										office.Bookmarks("nr_" + cid + "_title").range.text = "";
									}
									bookMark = office.Bookmarks(bookMarkName);
									end = bookMark.end;
									newRange = office.Range(end, end);
									newRange.Font.Name = "仿宋_GB2312";
									newRange.Font.Size = 14;
									newRange.font.Bold = true;
									newRange.text = "▲" + title + "。";
									office.Bookmarks.Add("nr_" + cid + "_title", newRange);
									var _end = office.Bookmarks("nr_" + cid + "_title").end;
									newRange = office.Range(_end, _end);
									newRange.font.Bold = false;
									newRange.Font.Name = "仿宋_GB2312";
									newRange.Font.Size = 14;
									newRange.text = content;
									//newRange = office.Range(end,office.Bookmarks("body").end-1);
									office.Bookmarks.Add("nr_" + cid, newRange);
									bookMarkName = "nr_" + cid;
									newSiftData[cid] = dataList[i];
								} catch (e) { console.log("来文加载异常", dataList[i], e); }
							}
						}
					} catch (e) { console.log("栏目加载异常", _data[typeid], e); }
				}
				for (var obj in siftData) {
					try {
						var sift = siftData[obj];
						if (!checkArrayContain(returnList, sift.id)) {
							office.Bookmarks("nr_" + sift.id).range.text = "";
							office.Bookmarks("nr_" + sift.id + "_title").range.text = "";
						}
					} catch (e) { console.log("清除未选中来文异常", listData[i], e); }
				}
				for (var obj in data) {
					try {
						if (!(obj in _data)) {
							office.Bookmarks("lm_" + data[obj].id).range.text = "";
						}
					} catch (e) { console.log("清除空栏目异常", data[obj], e); }
				}
				//alert(bookMarkName);
				if (flag && bookMarkName != "Content") {
					try {
						office.Bookmarks("Content").Delete();
						bookMark = office.Bookmarks(bookMarkName);
						var end = bookMark.end;
						office.Bookmarks.Add("Content", office.Range(end, end));
					} catch (e) {
						console.log("content标签重置异常", e);
					}
					try {
						office.Range(startIndex, office.Bookmarks("lm_" + sbookMarkId).start).text = "";
					} catch (e) {
						console.log("标签前置内容清空异常", e);
					}
				}
				window.parent.siftData = newSiftData;
				window.parent.columnData = _data;
				//listData = returnList;
				//data = _data;
				//typeList = _typeList;
			} catch (e) { alert(e); console.log(bookMarkName, e); }
		}

		//调整期数
		function changePeriods() {
			if (!checkBody()) {
				alert("文档已经损坏");
				return;
			}
			try {

				var office = document.getElementById("WebOffice").WebObject;
				var obj = office.BookMarks('periods');
				if (!obj) {
					alert("Word 模板中不存在名称为：periods的书签！");
				}
				var newRange = obj.Range;
				newRange.text = window.parent.periods;
				office.Bookmarks.Add('periods', newRange);
			} catch (e) { alert(e); console.log(bookMarkName, e); }
		}

		//追加
		function addContent(jsonData) {

			//alert("htmlsiftdatas" + JSON.stringify(jsonData.siftDatas));
			if (!checkBody()) {
				alert("文档已经损坏");
				return;
			}
			for (var n = jsonData.siftDatas.length - 1; n >=0; n--) {
				var siftDatas = jsonData.siftDatas[n];
				try {
					var office = document.getElementById("WebOffice").WebObject;
					var count = office.Bookmarks.Count;
					//alert("当前书签的个数为：" + count);
					var tempList = [];
					var temp = {};
					for (var i = 1; i <= count; i++) {
						temp[office.Bookmarks(i).Name] = office.Bookmarks(i).Start;
					}
					var temp2 = sortObj(temp);
					var index = 1;
					for (var i in temp2) {
						tempList.push(i);
						temp2[i] = index;
						index++;
						//alert("temp2:" + i + "  " + temp2[i]);
					}
					if (!office.Bookmarks.Exists("lm_" + siftDatas.columnId)) {
						var bookMarkName = 'Content';
						var bookMark = office.Bookmarks(bookMarkName);
						var end = bookMark.end;
						var newRange = office.Range(end, end);
						newRange.Font.Name = "仿宋_GB2312";
						newRange.Font.Size = 14;
						newRange.font.Bold = true;
						newRange.text = "【" + siftDatas.columnName + "】\n";
						office.Bookmarks.Add("lm_" + siftDatas.columnId, newRange);
						bookMarkName = "lm_" + siftDatas.columnId;
						bookMark = office.Bookmarks(bookMarkName);
						end = bookMark.end;
						newRange = office.Range(end, end);
						newRange.Font.Name = "仿宋_GB2312";
						newRange.Font.Size = 14;
						newRange.font.Bold = true;
						newRange.text = "▲" + siftDatas.title + "。";
						office.Bookmarks.Add("nr_" + siftDatas.id + "_title", newRange);
						var _end = office.Bookmarks("nr_" + siftDatas.id + "_title").end;
						newRange = office.Range(_end, _end);
						newRange.font.Bold = false;
						newRange.Font.Name = "仿宋_GB2312";
						newRange.Font.Size = 14;
						var unit = siftDatas.unit ? ("（" + siftDatas.unit + "）") : "";
						newRange.text = siftDatas.content + unit + "\n";
						//newRange = office.Range(end,office.Bookmarks("body").end-1);
						office.Bookmarks.Add("nr_" + siftDatas.id, newRange);
						bookMarkName = "nr_" + siftDatas.id;
						try {
							office.Bookmarks("Content").Delete();
							bookMark = office.Bookmarks(bookMarkName);
							var end = bookMark.end;
							office.Bookmarks.Add("Content", office.Range(end, end));
						} catch (e) {
							console.log("content标签重置异常", e);
						}
					} else {
						//alert(temp2["lm_" + siftDatas.columnId]);
						if (temp2["lm_" + siftDatas.columnId]) {
							var curIndex = temp2["lm_" + siftDatas.columnId];
							for (var index = curIndex + 1; index <= count; index++) {
								if (index == count) {
									var bookMarkName = 'Content';
									var bookMark = office.Bookmarks(bookMarkName);
									var end = bookMark.end;
									var newRange = office.Range(end, end);
									newRange.Font.Name = "仿宋_GB2312";
									newRange.Font.Size = 14;
									newRange.font.Bold = true;
									newRange.text = "▲" + siftDatas.title + "。";
									office.Bookmarks.Add("nr_" + siftDatas.id + "_title", newRange);
									var _end = office.Bookmarks("nr_" + siftDatas.id + "_title").end;
									newRange = office.Range(_end, _end);
									newRange.font.Bold = false;
									newRange.Font.Name = "仿宋_GB2312";
									newRange.Font.Size = 14;
									var unit = siftDatas.unit ? ("（" + siftDatas.unit + "）") : "";
									newRange.text = siftDatas.content + unit + "\n";
									//newRange = office.Range(end,office.Bookmarks("body").end-1);
									office.Bookmarks.Add("nr_" + siftDatas.id, newRange);
									bookMarkName = "nr_" + siftDatas.id;
									try {
										office.Bookmarks("Content").Delete();
										bookMark = office.Bookmarks(bookMarkName);
										var end = bookMark.end;
										office.Bookmarks.Add("Content", office.Range(end, end));
									} catch (e) {
										console.log("content标签重置异常", e);
									}
									break;
								}
								var curName = tempList[index - 1];
								//alert("curName:  " + curName + "  " + index);
								if (curName.substr(0, 3) == "lm_") {
									var bookMarkName = tempList[index-1];
									//var bookMarkName = 'nr_592';
									//alert("插入的bookName：" + bookMarkName);
									var bookMark = office.Bookmarks(bookMarkName);
									var end = bookMark.start;
									var newRange = office.Range(end, end);
									newRange.Font.Name = "仿宋_GB2312";
									newRange.Font.Size = 14;
									newRange.font.Bold = true;
									newRange.text = "▲" + siftDatas.title + "。";
									office.Bookmarks.Add("nr_" + siftDatas.id + "_title", newRange);
									var _end = office.Bookmarks("nr_" + siftDatas.id + "_title").end;
									newRange = office.Range(_end, _end);
									newRange.font.Bold = false;
									newRange.Font.Name = "仿宋_GB2312";
									newRange.Font.Size = 14;
									var unit = siftDatas.unit ? ("（" + siftDatas.unit + "）") : "";
									newRange.text = siftDatas.content + unit + "\n";
									//newRange = office.Range(end,office.Bookmarks("body").end-1);
									office.Bookmarks.Add("nr_" + siftDatas.id, newRange);
									break;
								}
							}
						}
					}
				} catch (e) { alert(e); console.log(bookMarkName, e); }
			}

		}

		function sortObj(obj) {
			const keys = Object.keys(obj).sort(function (a, b) { return obj[a] - obj[b] })
			var newObj = {}
			for (var i = 0; i < keys.length; i++) {
				const key = keys[i]
				newObj[key] = obj[key]
			}
			return newObj
		}
		function checkArrayContain(list, cid) {
			for (var i = 0; i < list.length; i++) {
				if (list[i].id == cid)
					return true;
			}
			return false;
		}

		/*
		 * 	重新加载正文
		 */
		function contentReload() {
			var obj = parseQueryString(window.location.href);
			document.getElementById("WebOffice").RecordID = "";
			document.getElementById("WebOffice").Template = window.parent.doctemplate || '';
			var flag = document.getElementById("WebOffice").WebOpen();
			if (flag) {
				//loadContent();
			} else {
				alert("模板加载失败，请联系管理员。");
			}
			document.getElementById("WebOffice").RecordID = window.parent.versionId + "_" + window.parent.docid;

		}

		/*
		 * Shapes下元素type
		msoAutoShape			1	自选图形。
		msoCallout				2	标注。
		msoCanvas				20	画布。
		msoChart				3	图。
		msoComment				4	批注。
		msoDiagram				21	图表。
		msoEmbeddedOLEObject	7	嵌入的 OLE 对象。
		msoFormControl			8	窗体控件。
		msoFreeform				5	任意多边形。
		msoGroup				6	组合。
		msoIgxGraphic			24	SmartArt 图形
		msoInk					22	墨迹。
		msoInkComment			23	墨迹批注。
		msoLine					9	线条。
		msoLinkedOLEObject		10	链接 OLE 对象。
		msoLinkedPicture		11	链接图片。
		msoMedia				16	媒体。
		msoOLEControlObject		12	OLE 控件对象。
		msoPicture				13	图片。
		msoPlaceholder			14	占位符。
		msoScriptAnchor			18	脚本定位标记。
		msoShapeTypeMixed		-2	混和形状类型。
		msoTable				19	表。
		msoTextBox				17	文本框。
		msoTextEffect			15	文本效果。
		 * */
		var flag = false;
		/*
		 * 	显示隐藏红头
		 */
		function changeRed() {
			var office = document.getElementById("WebOffice").WebObject;
			try {
				var count = office.Shapes.count;
				for (var i = 1; i <= count; i++) {
					try {
						var type = office.Shapes.Range(i).type;
						if (type == 1) {
							office.Shapes.Range(i).line.visible = flag;
						} else if (type == 9) {
							office.Shapes.Range(i).line.visible = flag;
						} else if (type == 17) {
							if (office.Shapes.Range(i).name != "periods")
								office.Shapes.Range(i).visible = flag;
							//office.Shapes.Range(i).TextFrame.TextRange.text = "";
						}
					} catch (e) { }
				}
			} catch (e) { }
			flag = !flag;
		}

		function WebSaveLocal() {
			try {
				var office = document.getElementById("WebOffice");
				var obj = parseQueryString(window.location.href);
				var hisFileName = office.FileName;
				var tempFileName = obj.mFileName;

				tempFileName = tempFileName.replace(/\\/g, '＼');
				tempFileName = tempFileName.replace(/\//g, '／');
				tempFileName = tempFileName.replace(/:/g, '：');
				tempFileName = tempFileName.replace(/\*/g, '×');
				tempFileName = tempFileName.replace(/\?/g, '？');
				tempFileName = tempFileName.replace(/\"/g, '“');
				tempFileName = tempFileName.replace(/</g, '＜');
				tempFileName = tempFileName.replace(/>/g, '＞');
				tempFileName = tempFileName.replace(/\|/g, '｜');

				var tempfiletype = tempFileName.substring(tempFileName.lastIndexOf("."), tempFileName.length);
				//if(tempfiletype!=null&&(tempfiletype==".doc"||tempfiletype==".xls"||tempfiletype==".ppt"||tempfiletype==".wps"||tempfiletype==".docx"||tempfiletype==".xlsx"||tempfiletype==".pptx"||tempfiletype==".et")){
				tempFileName = tempFileName.substring(0, tempFileName.lastIndexOf("."));
				tempFileName = tempFileName.replace(/\./g, '．');
				tempFileName = tempFileName + tempfiletype;
				//}  

				tempFileName = tempFileName.replace(/\./g, '．');
				office.FileName = tempFileName;

				office.WebSaveLocal();
				StatusMsg(office.Status);

				office.FileName = hisFileName;
			} catch (e) { }
		}

		function onPrintDoc() {
			document.getElementById("WebOffice").WebOpenPrint();
		}

		function SaveDocument(isReload) {
			if (isReload == true) {
				document.getElementById("WebOffice").SAVETYPE = 'E9EDIT';
			}
			document.getElementById("WebOffice").WebSetMsgByName("SAVETYPE", document.getElementById("WebOffice").SAVETYPE);
			//alert("SAVETYPE" + document.getElementById("WebOffice").SAVETYPE);
			var success = document.getElementById("WebOffice").WebSave();
			if (!success) {
				StatusMsg(WebOffice.Status);
				return { off_status: 0 };
			} else {
				StatusMsg(WebOffice.Status);
				// return document.getElementById("WebOffice").WebGetMsgByName("CREATEID");
				return {
					off_status: 1,
					off_docid: document.getElementById("WebOffice").WebGetMsgByName("CREATEID"),
					off_versionid: document.getElementById("WebOffice").WebGetMsgByName("VERSIONID"),
					off_imagefileid: document.getElementById("WebOffice").WebGetMsgByName("IMAGEFILEID"),
				};
			}
		}
        //金格2015方法 防止报错2003增加空方法
        //作用：展示插件
        function showIwebOffice(){
        }
        //作用：隐藏插件
        function hideIwebOffice(){
        }
	</script>
</head>

<body onLoad="Load()" onUnload="UnLoad()">
	<object name="WebOffice" id="WebOffice" width="100%" height="100%" classid="clsid:23739A7E-5741-4D1C-88D5-D50B18F7C347"
	 codeBase="/docs/docs/iWebOffice2003.ocx#version=8.8.7.28">
		<param name="wmode" value="Opaque">
	</object>
</body>

</html>